from common.models import TbKnowledgepoints


class KnowledgePoint:
    @staticmethod
    def update():
        points = TbKnowledgepoints.objects.all()
        for point in points:
            try:
                parent_point = TbKnowledgepoints.objects.get(point_id=point.parent_id)
            except TbKnowledgepoints.DoesNotExist:
                continue
            point.parent_id = parent_point.id
            point.save()
